package com.dex4d.ui.main.model;

import com.dex4d.utils.Log;
import com.dex4d.utils.SPUtil;

import org.web3j.utils.Numeric;

import java.math.BigInteger;

/**
 * 作者    LiQingyi
 * 时间    2018/11/2 16:05
 * 文件    dex4d-android
 * 描述
 */
public class Dex4dTransaction {
    public BigInteger nonce;
    public BigInteger gasPrice;
    public BigInteger gasLimit;

    public Dex4dTransaction(String limit) {
        this.gasLimit = Numeric.toBigInt(limit);
    }

    public Dex4dTransaction(BigInteger gasLimit) {
        this.gasLimit = gasLimit;
    }

    @Override
    public String toString() {
        return "Dex4dTransaction{" +
                "nonce=" + nonce +
                ", gasPrice=" + gasPrice +
                ", gasLimit=" + gasLimit +
                '}';
    }

    /**
     * 比较大小
     *
     * @param nonceStr
     */
    public void setNonce(String nonceStr) {
        this.nonce = SPUtil.getLocalNonce(nonceStr);
    }

    public void setGasPrice(String gasPriceStr) {
        this.gasPrice = new BigInteger(gasPriceStr);
    }
}
